<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>复选框</h2>
      <!-- 如果只有一个复选框绑定了这个变量，绑定的值是布尔值 -->
      <input type="checkbox" v-model="checked" />
      <label>{{ checked }}</label>

      <!-- 如果有多个复选框同时绑定了同一个变量，绑定的值是数组 -->
      <input type="checkbox" v-model="names" value="zhangsan" />
      <input type="checkbox" v-model="names" value="zhangjun" />
      <p>{{ names }}</p>
    </div>

    <script src="./Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          checked: true,
          names: [],
        },
      });
    </script>
  </body>
</html>
